#ifndef __DESALGORITHM_H__
#define __DESALGORITHM_H__



typedef enum
{
    false = 0,
    true  = 1
} BoolType;




void BitsCopy ( BoolType *DatOut, BoolType *DatIn, unsigned char Len );         // 数组复制
void ByteToBit ( BoolType *DatOut, unsigned char *DatIn, unsigned char Num ); // 字节到位
void HexToBit ( BoolType *DatOut, unsigned char *DatIn, unsigned int Num );
void BitToHex ( unsigned char *DatOut, BoolType *DatIn, unsigned char Num ); // 二进制到十六进制 64位 to 4*16字符
void TablePermute ( BoolType *DatOut, BoolType *DatIn, const unsigned char *Table, unsigned char Num ); // 位表置换函数
void LoopMove ( BoolType *DatIn, unsigned int Len, unsigned char Num );   // 循环左移 Len长度 Num移动位数
void Xor ( BoolType *DatA, BoolType *DatB, unsigned char Num );    // 异或函数
void S_Change ( BoolType *DatOut, BoolType *DatIn ); // S盒变换
void F_Change ( BoolType *DatIn, BoolType *DatKi ); // F函数
void SetKey ( unsigned char *KeyIn );                   // 设置密钥
void PlayDes ( unsigned char *MesOut, unsigned char *MesIn );  // 执行DES加密
void KickDes ( unsigned char *MesOut, unsigned char *MesIn );
void Play3Des ( unsigned char *MesOut, unsigned char *MesIn,unsigned char *PwdL,unsigned char *PwdR ); // 执行3DES加密
void DO_DES(unsigned char *MesIn, unsigned char *KeyIn ,unsigned char *MesOut);
void DO_3DES(unsigned char *MesIn, unsigned char *KeyIn ,unsigned char *MesOut);
void UNDO_DES(unsigned char *MesIn, unsigned char *KeyIn ,unsigned char *MesOut);
void UNDO_3DES(unsigned char *MesIn, unsigned char *KeyIn ,unsigned char *MesOut);
#endif